package com.lc.recovery.ui.fragment;

import android.os.Bundle;
import android.view.View;

import com.flyco.tablayout.SlidingTabLayout;
import com.lc.recovery.R;
import com.lc.recovery.adapter.MyFragmentPagerAdapter;
import com.lc.recovery.app.AppFragment;
import com.lc.recovery.ui.activity.HomeActivity;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;

public class MessageRecoveryFragment extends AppFragment<HomeActivity> {




    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R.id.viewpager)
    ViewPager viewPager;

    private MyFragmentPagerAdapter mAdapter;

    private List<String> titles = new ArrayList<>();//title集合

    private List<Fragment> fragments = new ArrayList<>();//碎片集合

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_messagerecovery;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }


    @Override
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        viewPager.setOffscreenPageLimit(2);
        titles.add("回收消息");
        titles.add("系统消息");
        titles.add("余额变动");
        titles.add("差额通知");
        fragments.add(MessageListFragment.newInstance("4"));
        fragments.add(MessageListFragment.newInstance("5"));
        fragments.add(MessageListFragment.newInstance("6"));
        fragments.add(MessageListFragment.newInstance("7"));
        mAdapter = new MyFragmentPagerAdapter(getChildFragmentManager(), fragments, getContext(), titles);
        viewPager.setAdapter(mAdapter);
        slidingTabLayout.setViewPager(viewPager);
//
    }



}
